package com.example.file.controller;

import com.example.common.util.core.controller.BaseController;
import com.example.common.util.core.resultbody.AjaxResult;
import com.example.file.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author juzipi
 * @Date 2021/7/20 14:19
 * @Info
 */
@RestController
@RequestMapping("api/file/file")
public class FileApiController extends BaseController {


    @Autowired
    private FileService fileService;


    //上传文件到腾讯云
    @PostMapping("upload")
    public AjaxResult fileUploadCloud(MultipartFile file) {
        //获取上传文件
        String url = fileService.uploadFile(file);
        return AjaxResult.success(url);
    }


}
